package cn.tedu.tmall.front.mall.dao.repository.impl;

import cn.tedu.tmall.front.mall.dao.mapper.OrderItemMapper;
import cn.tedu.tmall.front.mall.dao.repository.IOrderItemRepository;
import cn.tedu.tmall.front.mall.pojo.po.OrderItemPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class OrderItemRepository implements IOrderItemRepository {

    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
    public Integer save(OrderItemPO orderItemPO) {
        return orderItemMapper.insert(orderItemPO);
    }

    @Override
    public List<OrderItemPO> listOrderItemByOrderId(Long orderId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("order_id", orderId);
        return orderItemMapper.selectList(queryWrapper);

    }
}
